﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/SiteContent.Master" AutoEventWireup="true"
    CodeBehind="BillList.aspx.cs" Inherits="Warehouse.Web.Purchase.BillList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .datatable {
            width: 100%;
        }
        .status_1 {
            color: Red;
        }
    </style>

    <script type="text/javascript">
        $(function () {
            $(".datepicker").datepicker({ dateFormat: 'yy-mm-dd' });
        });
        function search() {
            window.location.href = "BillList.aspx?search=1&Type=" + $('#<%= this.dpBillType.ClientID %>').val() + "&Supplier=" + $('#<%= this.dpSupplier.ClientID %>').val() + "&Start=" + $('#<%= this.tbStartDate.ClientID %>').val() + "&End=" + $('#<%= this.tbEndDate.ClientID %>').val()
            + "&SerialNum=" + $('#<%= this.tbSerialNum.ClientID %>').val() + "&Summary=" + $('#<%= this.tbSummary.ClientID %>').val();
        }
        function showBill(Id, type) {
            if (type > 0) {
                var title = ["", "进货单", "赠品单", "退货单"][type];
                top.showWindow("/Purchase/BillView.aspx?ID=" + Id, { title: title, width: 700, height: 500 }, function(refresh) {
                    if (refresh) {
                        window.location.reload();
                    }
                });
            } else {
                var title = ["", '进货付款单', '退货收款单'][0 - type];
                top.showWindow("/Purchase/PaymentView.aspx?ID=" + Id, { title: title, width: 700, height: 500 }, function(refresh) {
                    if (refresh) {
                        window.location.reload();
                    }
                });
            }
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="moduleheader">
        <h4>
            单据查询</h4>
        
    </div>
    <div class="modulecontent">
        <div class="moduleheadertoolbar">
            <p>
                <label>
                    单据类型：
                    <asp:DropDownList ID="dpBillType" runat="server" DataTextField="Text" DataValueField="Value"></asp:DropDownList>
                </label>
                <label>
                    供应商：
                    <asp:DropDownList runat="server" ID="dpSupplier" DataTextField="Name" DataValueField="ID"></asp:DropDownList>
                </label>
                <label>
                    订单编号：
                    <asp:TextBox ID="tbSerialNum" runat="server"></asp:TextBox>
                </label>
                <label>
                    备 注：
                    <asp:TextBox ID="tbSummary" runat="server"></asp:TextBox>
                </label>
            </p>
            <p style="margin-top:5px; margin-bottom:5px;">
                <label>
                    录入日期：
                    <asp:TextBox ID="tbStartDate" runat="server" ReadOnly="true" CssClass="datepicker"></asp:TextBox>
                </label>
                <label>
                    —
                    <asp:TextBox ID="tbEndDate" runat="server" ReadOnly="true" CssClass="datepicker"></asp:TextBox>
                </label>
                <input type="button" class="ui-button-query" onclick="search();return false;" value="查询" style=" margin-left:30px;"/>
            </p>
        </div>
        <asp:Repeater ID="rptBills" runat="server">
            <HeaderTemplate>
                <table class="datatable">
                    <thead>
                        <tr>
                            <th class="col-sn">
                                单据编号
                            </th>
                            <th class="col-date">
                                录入日期
                            </th>
                            <th class="col-supplier">
                                供货商
                            </th>
                            <th class="col-type">
                                类型
                            </th>
                            <th class="col-house">
                                仓库
                            </th>
                            <th class="col-summary">
                                摘要
                            </th>
                        </tr>
                    </thead>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class="status_<%# Eval("Status")%>">
                    <td class="col-sn">
                        <a href="#<%# Eval("ID")%>" onclick="showBill('<%# Eval("ID")%>',<%# Eval("Type")%>);return false;">
                            <%# Eval("SerialNumber")%></a>
                    </td>
                    <td class="col-date">
                        <%# Eval("Date","{0:d}")%>
                    </td>
                    <td class="col-supplier">
                        <%# Eval("SupplierName")%>
                    </td>
                    <td class="col-type">
                        <%# Eval("TypeName")%>
                    </td>
                    <td class="col-house">
                        <%# Eval("HouseName") %>
                    </td>
                    <td class="col-summary">
                        <%# Eval("Summary")%>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
    </div>
</asp:Content>
